package pl.easyshop.core.model;

import java.math.BigDecimal;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Proxy;


/**
 * Product data model.
 * 
 * @author Pawel Witkowski
 */
/*@Entity
@Table(name="PRODUCT")
@Proxy(lazy=false)*/
public class ProductModel extends AbstractBaseModel {

	/** Unique serialization identifier. */
	private static final long serialVersionUID = -6997463801515137243L;

	/** Name of product. */
	@Column(name="name", length=128, nullable=false)
	private String name;
	
	@Column(name="code", length=128)
	private String productCode;
	
	/** Short product description. */
	@Column(name="short_description", length=256, nullable=false)
	private String shortDescription;
	
	/** Long product description. */
	@Column(name="long_description", length=1024, nullable=false)
	private String description;
	
	/** Price of product without tax. */
	@Column(name="price", precision=2, nullable=false)
	private BigDecimal price;
	
	/** Tax. */
	@Column(name="tax", nullable=false)
	private int tax;
	
	/** Quantity. */
	@Column(name="quantity")
	private int quantity;

	/** The field holds the value of the minimum number of product 
	 * if the product quantity will be less than this value, user will be notified. */
	@Column(name="alarm_quantity")
	private int alarmQuantity;
	
	/** Value <code>true</code> means product is avaiable and is display on product list. */
	@Column(name="is_available")
	private boolean available;
	
	/** Sort priority. */
	@Column(name="sort_priority")
	private int sortPriority;
	
	/** Product category. */
	@ManyToMany
	@JoinTable
	private List<CategoryModel> category;
	
	/** Similar products. */
	private List<ProductModel> similarProducts;
	
	
	
}
